package entity;

import java.util.ArrayList;
import java.util.Collection;
import javax.ejb.CreateException;
import javax.ejb.EJBLocalHome;
import javax.ejb.FinderException;
import transfer.Commodity;

/**
 *
 * @author Sergey, yarko, Oleh
 */
public interface CommodityLocalHome extends EJBLocalHome {

    CommodityLocal create(Commodity commodity) throws CreateException;

    CommodityLocal findByPrimaryKey(Integer idCommodity) throws FinderException;

    Collection findByPopularity(int count) throws FinderException;

    /**
     * Find commodities for page
     *
     * @param page Number of page
     * @param count Size of page
     * @return
     * @throws FinderException
     */
    Collection findAllGoods(int page, int count) throws FinderException;

    /**
     * Find commodities for page
     *
     * @param category Id category
     * @param page Number of page
     * @param count Size of page
     * @return
     * @throws FinderException
     */
    Collection findByCategory(int category, int page, int count) throws FinderException;

    /**
     *
     * @param idCategory
     * @return amount goods of category
     */
    int amountGoodsOfCategory(Integer idCategory);

    /**
     * @return all amount goods
     */
    int amountGoods();

    /**
     * prepare popularity report
     *
     * @param idWarehouse  report for certain warehouse or for all warehouses, null -
     * all warehouses
     * @param startRow start row, if null - start row equals 1
     * @param quantity quantity rows, if null - get all rows from start row to
     * last row
     * @return return list of PopularityReport objects
     */
    ArrayList getPopularityReport(Integer idWarehouse, Integer startRow, Integer quantity);
}